Setting up Make Support

In this section, you will learn how to set up Make Support for your projects. To set up Make Support:

Start SNiFF+ and open the project for which you want to set up Make Support.
Check out the Project Description Files (PDFs) of all the projects for which you will be building targets.
In the Project Tree, checkmark all the projects for which you will be building targets.
Choose Project > Attributes of Checkmarked Projects....
The Group Project Attributes dialog appears.
Select the Build Options node.

Setting common Make attributes in the Group Project
Attributes dialog
You will now set those Make attributes which are the same for all the projects for which you will be building targets. Basically, to set the attributes, you will perform the following tasks:

- Specify the command you want to use for calling your Make utility in SNiFF+.
- Generate include and dependencies information for the project and its subprojects.

Make attributes in the Group Project Attributes dialog are grouped into 5 main views. In the rest of this section, you will set the attributes, one view at a time.
In the Build Options view

If you use SNiFF+'s Make Support, select the Use SNiFF+ Make Support checkbox.
If you use a Make System other than the SNiFF+ Make System, in the Make Command field enter the command that you use to call Make.
This Make command will then be executed in SNiFF+'s Shell tool when you launch Make in SNiFF+. If you use the SNiFF+ Make System, the default Make command is used.
Select the check box to the right of the Make Command field.
This attribute will now also apply to all projects checkmarked in the Project Tree.
Select the Directives node.

In the Directives view
Setting up the Include Directives

Generate include information by pressing the Generate button. Then, manually edit the Include Directive(s) field by removing the include directives for all subdirectories that your compiler can ignore during file searches.
As a rule, you should update your project's include directives whenever you include new files that aren't in the path shown in the Include Directive(s) field.

| Note
| When you press the Generate button SNiFF+ enters include directives for the project directory and all subproject directories in the Include Directive(s) field. SNiFF+ does not check whether all the directories listed in the field actually contain include files or not. Include files must be located in the project structure; otherwise, SNiFF+ won't take them into account when updating its Make Support Files. Paths to include files outside of the project structure should be added in the Additional field. For a large project, we suggest that you make a backup of its include directives. You can find a project's include directives in the macros.incl Make Support File in the .sniffdir subdirectory of your project directory.

2. Select the check boxes to the right of the Generate button.
3. Select the Advanced node.

In the Advanced view

To optimize how SNiFF+ generates the project's dependencies information, select the Use Include Directives for Dependencies Generation check box (see Optimizing how SNiFF+ determines dependencies for details). Also select the check box to its right.
Press the Set For All button to apply to all the projects checkmarked in the Project Tree.
Select the Parser node.

In the Parser view

If you use

<> instead of "" to include header files located in the project structure, select the Use Standard Header Dependencies check box. Then, select the check box to its right.
For example, select the check box if you use the following syntax:
#include <header_file.h>
SNiFF+ will then be able to generate the project's include path information correctly. It does so by treating the above include statement like the following:
#include "header_file.h"
Press the Set For All button to apply to all the projects checkmarked in the Project Tree.
Press the Ok button to apply the settings and to close the Group Project Attributes dialog.
Notice that the Project Tree indicates that all checkmarked projects are modified. We recommend that you save all modified projects at this time.
Optimizing how SNiFF+ determines dependencies
To optimize SNiFF+'s include file search process during the generation of the project's dependencies.incl Make Support File, enable the Use Include Directives for Dependencies Generation checkbox.
The following diagrams show how SNiFF+ finds include files based on the status of the Use Include Directives for Dependences Generation checkbox.
Case 1
Suppose your project has a project structure like this one:

The header file

bar.h is in two subprojects: in one that is listed in the Include Directive(s) field and in one that isn't.

- When the Use Include Directives for Dependencies Generation check box is selected, SNiFF+ will search for

bar.h in the subprojects that are listed in the Include Directive(s) field.
- When the Use Include Directives for Dependencies Generation check box is not selected, SNiFF+ will search for
bar.h in the entire Project Tree. SNiFF+ will end the search as soon as it (randomly) finds the first bar.h file.
Case 2
Another possible situation in which this checkbox plays an important role is described in the following illustration.

The header file

bar.h is in a subproject that isn't listed in the Include Directive(s) field.

- When the Use Include Directives for Dependencies Generation check box is selected, SNiFF+ will search for

bar.h in the subprojects that are listed in the Include Directive(s) field. Since it won't be able to find bar.h in one of these subprojects, SNiFF+ will continue searching in the rest of the Project Tree until it finds the header file. When SNiFF+ finds the header file, it will give you a warning message to inform you that the Include Directive(s) field may no longer be up-to-date.
- When the Use Include Directives for Dependencies Generation check box is not selected, SNiFF+ will search for
bar.h in the entire Project Tree and will end the search as soon as it finds the file.
Project-specific attributes in the Project Attributes dialog
You will now set those Make attributes which are specific to each project for which you will be building targets.
Please complete the following steps for each project:

- In the Project Tree, double-click on the project for which you will be setting project-specific Make attributes.
The Project Attributes dialog appears.

In the Project Attributes dialog

- Select the Project Targets node.
You will now set those Make attributes which are unique for each project. Basically, to set the attributes, you will do the following:
- Enter the name(s) of the target(s) to be built in the project.
- Enter any external libraries or object files needed for building the project's target.
- Generate directories for a recursive build (if used).
- Tell SNiFF+ whether targets built for the project are needed by the superproject.
In the rest of this section, you will set the attributes, one view at a time.

In the Project Targets view

Enter the name of the project's default target.

- If the target is an executable, enter its name in the Executable field.
- If the target is an relinkable object, enter its name in the Relinkable Object field.
- If the target is a library object, enter its name in the Library field.

If external libraries or object files are required by the target (executable or relinkable object), enter these in the Libraries Linked field. Use the exact command-line syntax as required by the linker (e.g.

-lm ) on your platform.
If you want to build additional targets, enter their names in the Other field. Use a colon ( : ) to separate target names.
Note that SNiFF+'s Make Support does not provide Make rules for building targets listed in the Other field. You can write the rules for building these targets in the General Makefile or in the project's Makefile. However, if the same target is to be built in more than one project, you should write the rule for building it in the General Makefile.

| For purify and quantify targets
| You can enter purify and quantify targets in the Other field. For these two special targets, SNiFF+ does provide Make rules. Please refer to Building purify and quantify targets (Unix only) for details.

- Select the Build Structure node.
  In the Build Structure view

  From the Passed to Superproject drop-down menu, choose the type of target to be exported to the superproject. The object of this type is then displayed in the Received from Subprojects field in the superproject's Make attributes.
  For details about using the Passed to Superproject drop-down menu, please refer to Using the Passed to Superproject drop-down.

  | Note
  | All targets imported to a project are displayed in the Received from Subprojects field.

  2. To build your project's target recursively, make sure that the order of subproject directories listed in the Recursive Make Dir(s) field is correct.
     SNiFF+ will build -- in the order of listed subproject directories -- the default target of each of the subprojects during a recursive Make.
  3. If there are any discrepancies, press the Generate... button next to the field.
     SNiFF+ will regenerate the order of subproject directories.
     IMPORTANT: SNiFF+ considers only those subprojects that use SNiFF+ Make Support when generating the order of subprojects.
     Also, once you have pressed the Generate... button for a project, the Recursive Make Dir(s) field will be automatically updated whenever you add/remove subprojects.
  4. Press the Ok button to apply the Make attributes to the project.
  5. Save the modified project.
  Using the Passed to Superproject drop-down
  There are five entries in the Passed to Superproject drop-down. Note that the selection in the drop-down also determines whether any, some, or all of the objects of the project's subprojects are exported to its superproject.
  Relinkable object
  The relinkable object built in the project is exported to the superproject. Any targets imported to the project from its subprojects are used to build the relinkable object.

  Library
  The library built in the project is exported to the superproject. Object files and relinkable objects imported to the project from its subprojects are used to build the library. Any libraries exported from subprojects are directly imported to the superproject.

  Object files + Received
  Any library, relinkable object and/or executable targets built in the project are not exported to the superproject.
  The object files in the project (built from the source files in the project), plus the targets exported from subprojects, are directly exported to the superproject.

  Received targets
  Targets imported to the project from its subprojects are used to build the project's target. Targets and object files built in the project are not exported to the superproject.
  The targets imported to the project are also exported to the superproject.

  None
  Targets imported to the project from its subprojects are used to build the project's target. Targets and object files built in the project are not exportable.
  This setting is appropriate when the project's target is an executable.